package review;

public class Dog {
    //狗具有的属性
    public String name;
    public String gander;
    int age;

    //狗具有的方法
    //构造方法
    public void init(String name,String gander,int age){
        this.name = name;
        this.gander = gander;
        this.age = age;
    }
    //狗在吃东西
    public void eat(){
        System.out.println(this.name + "在吃狗粮~~");
    }
    //狗在叫
    public void bark(){
        System.out.println(this.name + "发出汪汪汪的叫声~~");
    }
    //狗在睡觉
    public void sleep(){
        System.out.println(this.name + "已经在打鼾了~~");
    }

    //主方法
    public static void main(String[] args) {
        //实例化对象
        Dog dog1 = new Dog();
        Dog dog2 = new Dog();
        Dog dog3 = new Dog();
        dog1.init("阿黄","公",6);
        dog2.init("Jim","公",8);
        dog3.init("美丽","母",3);

        //对象执行对应方法功能
        dog1.bark();
        dog2.eat();
        dog3.sleep();

    }

}
